<template>
	<view style="padding: 30rpx;">
		<view style="background-color: #fff;border-radius: 16rpx;">
			<u-cell-item v-if="orderInfo.orderProcessStatus===1" :arrow="false" hover-class="none"
				:title="orderInfo.orderCode" value="待处理"></u-cell-item>
			<u-cell-item v-if="orderInfo.orderProcessStatus===3" :arrow="false" hover-class="none"
				:title="orderInfo.orderCode" value="服务人员待服务"></u-cell-item>
			<u-cell-item v-if="orderInfo.orderProcessStatus===4" :arrow="false" hover-class="none"
				:title="orderInfo.orderCode" value="服务中"></u-cell-item>
			<u-cell-item v-if="orderInfo.orderProcessStatus===5" :arrow="false" hover-class="none"
				:title="orderInfo.orderCode" value="已完成"></u-cell-item>
		</view>
		<view style="background-color: #fff;border-radius: 16rpx;margin-top: 20rpx;">
			<u-cell-item @click="callPhone(orderInfo.phone)" :arrow="false" hover-class="none"
				:title="orderInfo.buyerAddress" :label="orderInfo.trueName +' '+orderInfo.phone"></u-cell-item>
		</view>
		<view style="background-color: #fff;border-radius: 16rpx;margin-top: 20rpx;">
			<u-cell-item :arrow="false" hover-class="none" title="预计上门时间" :value="orderInfo.demandTime"></u-cell-item>
		</view>
		<view style="background-color: #fff;border-radius: 16rpx;padding: 30rpx;margin-top: 20rpx;">
			<view v-for="item in orderInfo.orderItemList"
				style="display: flex;align-items: center;justify-content: space-between;margin-top: 20rpx;">
				<view style="display: flex;align-items: center;">
					<image :src="sysConstant.FILE_SRC_PATH + item.goodsImgPath" style="width: 120rpx;height: 120rpx;">
					</image>
					<view style="margin-left: 20rpx;">{{item.goodsName}}</view>
				</view>
				<view style="display: flex;align-items: center;justify-content: flex-end;">
					<view>x{{item.goodsNumber}}</view>
					<view v-if="orderInfo.userType == 1" style="margin-left: 30rpx;font-size: 32rpx;">￥ <text
							style="color: red;text-decoration: line-through;">{{item.goodsSellPrice}}</text>
						<text style="color: #F06000;margin-left: 10rpx;">{{item.memberPrice}}</text>
					</view>
					<view v-else style="margin-left: 30rpx;font-size: 32rpx;">￥{{item.goodsSellPrice}}</view>
				</view>
			</view>
			<view
				style="padding-top: 20rpx;border-top: #f8f8f8 solid 2rpx;margin-top: 20rpx;display: flex;align-items: center;justify-content: flex-end;">
				小计：￥{{orderInfo.goodsMoney}}
			</view>
		</view>
		<!-- <view style="background-color: #fff;border-radius: 16rpx;margin-top: 20rpx;" v-if="order.waiterId">
			<u-cell-item :arrow="false" hover-class="none" title="服务人员" value="三角函数计算机"></u-cell-item>
			<u-cell-item title="联系电话" value="三角函数计算机"></u-cell-item>
		</view> -->
		<view style="background-color: #fff;border-radius: 16rpx;margin-top: 20rpx;">
			<u-cell-item :arrow="false" hover-class="none" title="订单金额" :value="'￥'+orderInfo.totalMoney"></u-cell-item>
			<u-cell-item :arrow="false" hover-class="none" title="下单时间" :value="orderInfo.createTime"></u-cell-item>
			<u-cell-item v-if="orderInfo.payTime" :arrow="false" hover-class="none" title="支付时间"
				:value="orderInfo.payTime"></u-cell-item>
			<u-cell-item v-if="orderInfo.startTime" :arrow="false" hover-class="none" title="上门时间"
				:value="orderInfo.startTime"></u-cell-item>
			<u-cell-item v-if="orderInfo.waiterName" :arrow="false" hover-class="none" title="服人员姓名"
				:value="orderInfo.waiterName"></u-cell-item>
			<u-cell-item @click="callPhone(orderInfo.waitePhone)" v-if="orderInfo.waitePhone" :arrow="false"
				hover-class="none" title="服人员电话" :value="orderInfo.waitePhone"></u-cell-item>
			<u-cell-item v-if="orderInfo.endTime" :arrow="false" hover-class="none" title="结束时间"
				:value="orderInfo.endTime"></u-cell-item>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				orderInfo: {},
				sysConstant: this.sysConstant,

			}
		},
		onLoad(e) {
			let orderInfo = uni.getStorageSync('orderInfo')
			console.log("我是订单详情");
			let res = JSON.parse(orderInfo)
			this.orderInfo = res
			console.log(this.orderInfo);
			uni.removeStorageSync('orderInfo')
			if(e.orderCode){
				console.log("我是订单编号");
				this.orderCode = e.orderCode
				this.initOrderInfo()
			}
		},
		methods: {
			initOrderInfo() {
				this.$u.get("/life/order/info", {
					orderCode: this.orderCode
				}, this.header).then(res => {
					console.log(res)
					if (res.success) {
						this.orderInfo = res.data
						// this.initOrderItem()
					}
				})
			},

			initOrderItem() {
				this.$u.get("/life/order/item/list", {
					orderId: this.order.id
				}, this.header).then(res => {
					console.log(res)
					if (res.success) {
						this.orderItemList = res.data
					}
				})
			},
			callPhone(phone) {
				uni.makePhoneCall({
					phoneNumber: phone,
					complete() {
						console.log('')
					}
				});
			},

		}
	}
</script>

<style>
	page {
		background-color: #f8f8f8;
	}
</style>